package com.jkdz.spyke.rs
{
	import com.jkgh.remedy.core.client.*;
	import flash.utils.ByteArray;

	public class SpykeFileSharerRemoter implements RemedyRemoter
	{
		private var mo:SpykeFileSharer;

		public function SpykeFileSharerRemoter(mo:SpykeFileSharer)
		{
			this.mo = mo;
		}

		public function call(methodID:int, connection:RemedyClientServerConnection, onReturn:Function):void
		{
			switch (methodID)
			{
				case 32:
					var a_32:String = (String)(RemedyStringClassManager.INSTANCE.readWithGraph(connection, new Vector.<Object>()));
					var b_32:int = (int)(RemedyIntegerClassManager.INSTANCE.readWithGraph(connection, new Vector.<Object>()));
					var c_32:SpykeFileChunkProvider = (SpykeFileChunkProvider)(RemedyMOClassManager.INSTANCE.readWithGraph(connection, new Vector.<Object>()));
					mo.offerFile(a_32, b_32, c_32, function(ret:String):void {
						onReturn(ret, RemedyStringClassManager.INSTANCE);
					});
					break;
				case 31:
					mo.getName(function(ret:String):void {
						onReturn(ret, RemedyStringClassManager.INSTANCE);
					});
					break;
				case 30:
					mo.getFiles(function(ret:Vector.<FileInfo>):void {
						onReturn(ret, RemedyArrayClassManager.forType(73));
					});
					break;
			}
		}

		public function run(methodID:int, connection:RemedyClientServerConnection):void
		{
			switch (methodID)
			{
				case 33:
					var a_33:SpykeFileSharerListener = (SpykeFileSharerListener)(RemedyMOClassManager.INSTANCE.readWithGraph(connection, new Vector.<Object>()));
					mo.registerListener(a_33);
					break;
				case 34:
					var a_34:String = (String)(RemedyStringClassManager.INSTANCE.readWithGraph(connection, new Vector.<Object>()));
					mo.renameFolder(a_34);
					break;
				case 35:
					var a_35:String = (String)(RemedyStringClassManager.INSTANCE.readWithGraph(connection, new Vector.<Object>()));
					mo.unOfferFile(a_35);
					break;
				case 67:
					mo.unPublish();
					break;
				case 66:
					mo.publish();
					break;
			}
		}
	}
}
